package com.yyg.boot.interceptor;

import com.hazelcast.core.EntryEvent;
import com.hazelcast.map.listener.EntryAddedListener;
import com.hazelcast.map.listener.EntryRemovedListener;
import com.hazelcast.map.listener.EntryUpdatedListener;
import lombok.extern.slf4j.Slf4j;

/**
 * @Author 一一哥Sun
 * @Date Created in 2020/4/24
 * @Description 监听map中添加的消息
 */
@Slf4j
public class MapListener implements EntryAddedListener<String,String>,EntryUpdatedListener<String,String>,EntryRemovedListener<String,String> {

    @Override
    public void entryAdded(EntryEvent<String, String> entryEvent) {
        //监听新增数据
        log.warn("Hazelcast分布式监听map数据-->"+entryEvent.getValue());
    }


    @Override
    public void entryRemoved(EntryEvent<String, String> entryEvent) {
        //监听移除数据
    }

    @Override
    public void entryUpdated(EntryEvent<String, String> entryEvent) {
        //监听更新数据
    }
}
